home *** CD-ROM | disk | FTP | other *** search
/ Your Choice 3 / Your Choice Software Collection 3.iso / os2 / etelr21 / etcat.vrm < prev    next >
Text File  |  1994-09-13  |  3KB  |  158 lines

  1. /* Custom mainline for macro */
  2.  
  3.     call RXFuncAdd "VRLoadFuncs", "VROBJ", "VRLoadFuncs"
  4.     call VRLoadFuncs
  5.  
  6.     _VREVersion = SubWord( VRVersion( "VRObj" ), 1, 1 )
  7.     if( _VREVersion < 2.10 )then do
  8.         call VRMessage "", "This program requires VX-REXX version 2.1 to run.", "Error!"
  9.         return 32000
  10.     end
  11.  
  12.     signal on SYNTAX name _VRESyntax
  13.     signal _VREMain
  14.  
  15. _VRESyntax:
  16.     parse source . . _VRESourceSpec
  17.     call VRMessage "", "Syntax error in" _VRESourceSpec "line" SIGL":" ErrorText(rc), "Error!"
  18.     call VRFini
  19.     exit 32000
  20.  
  21. _VREMain:
  22. /*:VRX         Main
  23. */
  24. /*  Main
  25. */
  26. Main:
  27. /*  Process the arguments.
  28.     Get the parent window.
  29. */
  30.     parse source . calledAs .
  31.     parent = ""
  32.     argCount = arg()
  33.     argOff = 0
  34.     if( calledAs \= "COMMAND" )then do
  35.         if argCount >= 1 then do
  36.             parent = arg(1)
  37.             argCount = argCount - 1
  38.             argOff = 1
  39.         end
  40.     end
  41.     InitArgs.0 = argCount
  42.     if( argCount > 0 )then do i = 1 to argCount
  43.         InitArgs.i = arg( i + argOff )
  44.     end
  45.     drop calledAs argCount argOff
  46.  
  47. /*  Load the windows
  48. */
  49.     call VRInit
  50.     parse source . . spec
  51.     _VREPrimaryWindowPath = ,
  52.         VRParseFileName( spec, "dpn" ) || ".VRW"
  53.     _VREPrimaryWindow = ,
  54.         VRLoad( parent, _VREPrimaryWindowPath )
  55.     drop parent spec
  56.     if( _VREPrimaryWindow == "" )then do
  57.         call VRMessage "", "Cannot load window:" VRError(), ,
  58.             "Error!"
  59.         _VREReturnValue = 32000
  60.         signal _VRELeaveMain
  61.     end
  62.  
  63. /*  Process events
  64. */
  65.     call Init
  66.     signal on halt
  67.     do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
  68.         _VREEvent = VREvent()
  69.         interpret _VREEvent
  70.     end
  71. _VREHalt:
  72.     _VREReturnValue = Fini()
  73.     call VRDestroy _VREPrimaryWindow
  74. _VRELeaveMain:
  75.     call VRFini
  76. exit _VREReturnValue
  77.  
  78. VRLoadSecondary: procedure
  79.     name = arg( 1 )
  80.  
  81.     window = VRLoad( VRWindow(), VRWindowPath(), name )
  82.     call VRMethod window, "CenterWindow"
  83.     call VRSet window, "Visible", 1
  84.     call VRMethod window, "Activate"
  85. return window
  86.  
  87. /*:VRX         Fini
  88. */
  89. Fini:
  90.     window = VRWindow()
  91.     call VRSet window, "Visible", 0
  92.     drop window
  93. return 0
  94.  
  95. /*:VRX         Halt
  96. */
  97. Halt:
  98.     signal _VREHalt
  99. return
  100.  
  101. /*:VRX         Init
  102. */
  103. Init:
  104.     window = VRWindow()
  105.     call VRMethod window, "CenterWindow"
  106.     call VRSet window, "Visible", 1
  107.     call VRMethod window, "Activate"
  108.     drop window
  109. return
  110.  
  111. /*:VRX         LBCats_DoubleClick
  112. */
  113. LBCats_DoubleClick:
  114. call MenuIns_Click
  115. return
  116.  
  117. /*:VRX         MenuExit_Click
  118. */
  119. MenuExit_Click:
  120. call Quit
  121. return
  122.  
  123. /*:VRX         MenuIns_Click
  124. */
  125. MenuIns_Click:
  126. ok = VRMethod( "LBCats", "GetSelectedStringList", "item." )
  127. if item.0 = 0 then
  128.     signal Quit
  129. rc = item.1
  130. call VRMethod 'Application', 'PutVar', 'rc'
  131. signal Quit
  132. return
  133.  
  134. /*:VRX         Quit
  135. */
  136. Quit:
  137.     window = VRWindow()
  138.     call VRSet window, "Shutdown", 1
  139.     drop window
  140. return
  141.  
  142. /*:VRX         Window1_Close
  143. */
  144. Window1_Close:
  145.     call Quit
  146. return
  147.  
  148. /*:VRX         Window1_Create
  149. */
  150. Window1_Create:
  151. call VRMethod 'Application', 'GetVar', 'cats.'
  152. call VRMethod "LBCats", "AddStringList", "cats."
  153. rc = 'ERROR'
  154. call VRMethod 'Application', 'PutVar', 'rc'
  155. drop cats.
  156. return
  157.  
  158.